//
//  GuideViewController.m
//  moon
//
//  Created by beyself on 16/9/4.
//  Copyright © 2016年 beyself. All rights reserved.
//
#import "Utils.h"
#import "GuideViewController.h"

@interface GuideViewController ()

@end

@implementation GuideViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UIScrollView* scrollview = [[UIScrollView alloc] init];
    scrollview.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT + 64);
    scrollview.showsVerticalScrollIndicator = NO;
    scrollview.showsHorizontalScrollIndicator = NO;
    scrollview.contentSize = CGSizeMake(3*SCREEN_WIDTH, 0);
    scrollview.pagingEnabled = YES;
    [self.view addSubview:scrollview];
    
    for(int i = 0; i < 3; i++)
    {
        UIImageView* imageview = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"guide_%d",i]]];
        imageview.frame = CGRectMake(i*SCREEN_WIDTH, 0, SCREEN_WIDTH, SCREEN_HEIGHT + 64);
        imageview.contentMode = UIViewContentModeScaleAspectFill;
        [scrollview addSubview:imageview];
        
        if(i == 2)
        {
            UITapGestureRecognizer *singleTapGestureRecognizer = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(singleTap:)];
            [singleTapGestureRecognizer setNumberOfTapsRequired:1];
            imageview.userInteractionEnabled = YES;
            [imageview addGestureRecognizer:singleTapGestureRecognizer];
        }
    }
}

- (void)singleTap:(UIGestureRecognizer*)gestureRecognizer
{
    [Utils saveDefaultUser:@"1" key:@"isLogin"];
    [APPDELEGATE showMainView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}
@end
